<?php
error_reporting(0);
define('SITE_PREFIX', "DEV_");
define('SITE_ROOT', 'http://dev.socialvio.com/admin');
define('DB_SERVER', 'localhost');
define('DB_NAME', 'stamp2_dev');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', "");
define('ENCODE_KEY', '36918');
define('FILE_LOCATION', '');
define('OLD_HD_LOCATION', '/var/www/dev-socialvio-com/temp/hd/');
define('OLD_SD_LOCATION', '/var/www/dev-socialvio-com/temp/sd/');
define('VIDEO_LOCATION', '/opt/media/');
define('THUMB_LOCATION', 'thumb/');

function filename_encode($c_id) {
    $hash = sha1($c_id . ENCODE_KEY);
    $hash = substr($hash, 0, 16);
    return SITE_PREFIX . $c_id . "_" . $hash;
}

function report_encode($c_id)
{
	$hash = sha1($c_id . ENCODE_KEY);
	return $hash;
}

function runSQL($rsql) {
    $hostname = DB_SERVER;
    $username = DB_USERNAME;
    $password = DB_PASSWORD;
    $dbname = DB_NAME;
    $connect = mysql_connect($hostname, $username, $password) or die("Error: could not connect to database");
    $db = mysql_select_db($dbname);
    $charset = "SET NAMES'UTF8'";
    mysql_query($charset);
    $result = mysql_query($rsql) or die('Error: could not query data');
    return $result;
    mysql_close($connect);
}

function runSQL_num_row($result) {
    $hostname = DB_SERVER;
    $username = DB_USERNAME;
    $password = DB_PASSWORD;
    $dbname = DB_NAME;
    $connect = mysql_connect($hostname, $username, $password) or die("Error: could not connect to database");
    $result = mysql_num_rows($result);
    return $result;
    mysql_close($connect);
}

function countRec($fname, $tname, $where) {
    $sql = "SELECT count($fname) FROM $tname $where";
    $result = runSQL($sql);
    while ($row = mysql_fetch_array($result)) {
        return $row[0];
    }
}

?>
